import { Sprite } from 'cc';
import { Toggle } from 'cc';
import { ScrollView } from 'cc';
import { EditBox } from 'cc';
import { SpriteFrame } from 'cc';
import { Label } from 'cc';
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('EditorUI')
export class EditorUI extends Component {
    @property( {type: Label, displayName: "定位" } )
    currentBrick: Label = null;
    
    @property( {type: Sprite, displayName: "当前颜色" } )
    currentColorSprite: Sprite = null;
    
    @property( {type: [SpriteFrame], displayName: "当前颜色" } )
    frames: SpriteFrame[] = [];
    
    @property( {type: Toggle, displayName: "颜色池子开关" } )
    poolToggle: Toggle = null;
    
    @property( {type: Toggle, displayName: "地板开关" } )
    floorToggle: Toggle = null;
    
    @property( {type: EditBox, displayName: "最高位" } )
    maxInput: EditBox = null
    
    @property( {type: Node, displayName: "顶部面板" } )
    headNode: Node = null
    
    @property( {type: Node, displayName: "底部面板" } )
    bottomNode: Node = null
    
    @property( {type: ScrollView, displayName: "颜色容器" } )
    scrollView: ScrollView = null
    
    @property( {type: EditBox, displayName: "块数量" } )
    brickCountInput: EditBox = null
    
    @property( {type: EditBox, displayName: "缩放系数" } )
    scaleInput: EditBox = null
    
    @property( {type: Node, displayName: "颜色父节点" } )
    colorParent: Node = null

    public getColorActives(): number[] {
        const arr = []
        for (var i = 0; i < this.colorParent.children.length; i++) {
            const node = this.colorParent.children[i].getChildByName("背景")
            if (node.active == true) {
                arr.push(i)
            }
        }
        
        return arr
    }
}


